﻿using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Menu;
using Application = Autodesk.Revit.ApplicationServices.Application;
using xXYZ = Autodesk.Revit.DB.XYZ;

namespace RevitAddin
{
    [TransactionAttribute(TransactionMode.Manual)]
    [RegenerationAttribute(RegenerationOption.Manual)]
    public class FileCodeCMD : IExternalEventHandler
    {
       
        public Action<string> action { get; set; }

        public void Execute(UIApplication app)
        {
            UIDocument uidoc = app.ActiveUIDocument;
            Document doc = uidoc.Document;
            Application revitApp = app.Application;

            try
            {
               
                action?.Invoke(doc.Title);

            }
            catch (Exception ex)
            {
                TaskDialog.Show("温馨提示1", "\n" + ex.Message + ex.StackTrace);
            }
        }

        public string GetName()
        {
            return "BYQCodeCMD";
        }
    }
  
}
